import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
/**
 * All rights Reserved, Designed By www.super-master.cn
 *
 * @ProjectName: rock-paper-scissors
 * @Package: PACKAGE_NAME
 * @ClassName: file_write
 * @Description: []
 * <p> </p>
 * @Author: [cai]
 * @Date: 2022/4/26 10:35
 * @Version: V1.0
 **/

public class file_write {

    public static void File_write() throws IOException {
        File file = new File("d:\\result.txt");
        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
            System.out.println("文件已创建");
        } else {
            System.out.println("文件已存在");
        }


        FileOutputStream fos = new FileOutputStream("d:\\result.txt");
        //开始写
        /*String str = String.valueOf(Result.userWin);
        byte[] bytes = str.getBytes();
        //将byte数组中的所有数据全部写入
        fos.write(bytes);
         str = String.valueOf(Result.userDraws);
         bytes = str.getBytes();
        fos.write(bytes);
        str = String.valueOf(Result.userLosses);*/
        String str= String.valueOf("人赢了"+Result.userWin+        "平局"+ Result.userDraws+    "输了"+Result.userLosses);
        byte[] bytes = str.getBytes();
        fos.write(bytes);
        //fos.write(bytes);
        fos.close();

    }




}
